package com.tony;

import com.tony.service.SysInfoApi;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Consumer {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext context =
                new ClassPathXmlApplicationContext("consumer.xml");
        context.start();
        System.out.println("consumer start");
        SysInfoApi sysInfoApi = (SysInfoApi) context.getBean("sysInfoGoupApiImpl");
        System.out.println("consumer");
        System.out.println(sysInfoApi.getSysInfo("group"));
        System.out.println(sysInfoApi.getSysInfo("localhost",8080));

        sysInfoApi = (SysInfoApi) context.getBean("sysInfoGoup2ApiImpl");
        System.out.println("consumer");
        System.out.println(sysInfoApi.getSysInfo("group2"));
        System.out.println(sysInfoApi.getSysInfo("127.0.0.1",8080));
    }
}
